const { contextBridge, ipcRenderer } = require('electron')

contextBridge.exposeInMainWorld('appBridge', {
    userConfig: {
        getSlogan: (request) => {
            return ipcRenderer.sendSync('userConfig.getSlogan', request)
        },
        getAvatar: (request) => {
            return ipcRenderer.sendSync('userConfig.getAvatar', request)
        }
    },

    baseService: {
        search: (request) => {
            return ipcRenderer.sendSync('baseService.search', request)
        },
        runPlugin: (request) => {
            return ipcRenderer.sendSync('baseService.runPlugin', request)
        },
        runSysPluginByName: (request) => {
            return ipcRenderer.send('baseService.runSysPluginByName', request)
        },
        switchHide: (request) => {
            ipcRenderer.send('baseService.switchHide', request)
        },

    }
})

//------------------TODO 以上部分为appBridge的preload.js,打包插件时，需将该部分代码一起打包到插件的preload.js


const { app } = require('electron');
const { initSchedule } = require('./web/schedule/initSchedule');
const { initIPC } = require('./web/ipc/initIPC');
const { initShortCut } = require('./web/shortcut/initShortCut')
const { createMainWin } = require('./biz/baseService/mainWinConfig')
const EnvContext = require('./common/context/EnvContext');
const { initPreload } = require('./preload/initPreload');

initShortCut()
initIPC()
initSchedule()